﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProductEdit.ascx.cs" Inherits="MpSoft.Web.AdminCP.Controls.Product.ProductEdit" %>
<%@ Register Src="~/AdminCP/ToolsBar/NumberIncrement.ascx" TagPrefix="uc1" TagName="NumberIncrement" %>
<%@ Register Src="~/AdminCP/Controls/Modules/ContentLanguage.ascx" TagPrefix="uc1" TagName="ContentLanguage" %>
<%@ Register Src="~/AdminCP/ToolsBar/Categories.ascx" TagPrefix="uc1" TagName="Categories" %>
<%@ Register Src="~/AdminCP/ToolsBar/SelectImages.ascx" TagPrefix="uc1" TagName="SelectImages" %>
<%--XEditable--%>
<link rel="stylesheet" href="http://static.mpsoft.vn/Context/css/plugins/xeditable/bootstrap-editable.css">
<%--  Chosen  --%>
<script src="http://static.mpsoft.vn/Context/js/plugins/chosen/chosen.jquery.min.js"></script>
<%-- Bootbox --%>
<script src="http://static.mpsoft.vn/Context/js/plugins/bootbox/jquery.bootbox.js"></script>
<%--  XEditable  --%>
<script src="http://static.mpsoft.vn/Context/js/plugins/mockjax/jquery.mockjax.js"></script>
<script src="http://static.mpsoft.vn/Context/js/plugins/xeditable/bootstrap-editable.min.js"></script>
<div class="row">
    <br />
    <div class="col-sm-8">
        <asp:Literal ID="ltlMessage" runat="server"></asp:Literal>
    </div>
    <div class="col-sm-4 btn-form form-actions btn-options nopadding form-options">
        <a class="from-submit">
            <i class="glyphicon-edit"></i>
            <asp:Button ID="cmdSave" runat="server" Text="Lưu" OnClick="cmdSave_Click" CssClass="btn btn-green btn-large" />
        </a>
        <a class="from-submit">
            <i class="glyphicon-new_window"></i>
            <asp:Button ID="cmdSaveExit" runat="server" Text="Lưu & Thoát" OnClick="cmdSaveExit_Click" CssClass="btn btn-green btn-large" />
        </a>
        <a href="?mod=product" class="btn btn-large"><i class="glyphicon-right_arrow">&nbsp;</i> Quay lại</a>
    </div>
</div>
<div class="row">
    <div class="col-sm-12">
        <div class="box box-color box-bordered">
            <div class="box-title">
                <h3>
                    <i class="fa fa-bars"></i>
                    Thông tin sản phẩm
                </h3>
                <div class="actions">
                    <a href="#" class="btn btn-mini content-slideUp">
                        <i class="fa fa-angle-down"></i>
                    </a>
                </div>
            </div>
            <div class="box-content form-horizontal form-bordered nopadding">
                <ul class="tabs tabs-inline tabs-top">
                    <li class='active'>
                        <a href="#first11" data-toggle='tab'>
                            <i class="glyphicon-cogwheels"></i>Thông tin nhanh</a>
                    </li>
                    <li>
                        <a href="#second22" data-toggle='tab'>
                            <i class="glyphicon-cogwheels"></i>Nội dung chi tiết</a>
                    </li>
                      <%if (ShowLanguage)
                      { %><li><a>Chọn ngôn ngữ<select class="selectlanguage"><option value="#vn">Tiếng việt</option>
                        <%= TabLanguage() %></select></a></li>
                    <%} %>
                    <li>
                        <a href="#second33" data-toggle='tab'>
                            <i class="glyphicon-cogwheels"></i>Ảnh</a>
                    </li>
                    <li>
                        <a href="#second55" data-toggle='tab'>
                            <i class="glyphicon-cogwheels"></i>Thuộc tính</a>
                    </li>
                </ul>
                <div class="tab-content tab-content-inline tab-content-bottom">
                    <div class="tab-pane active" id="first11">
                        <div class="form-group">
                            <label for="textfield" class="control-label col-sm-2">Chọn cấp: </label>
                            <div class="col-sm-10">
                                <uc1:Categories runat="server" ID="ddlCategory" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="textfield" class="control-label col-sm-2">Hãng sản xuất: </label>
                            <div class="col-sm-10">
                                <asp:DropDownList ID="ddlManufacturer" runat="server" data-nosearch="true" CssClass="chosen-select"></asp:DropDownList>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">Giá sản phẩm: </label>
                            <div class="col-sm-10">
                                <asp:TextBox ID="txtPrice" runat="server" placeholder="Giá sản phẩm" CssClass="form-base" data-rule-number="true"></asp:TextBox>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">Giá Khuyến mại: </label>
                            <div class="col-sm-10">
                                <asp:TextBox ID="txtPriceNew" runat="server" placeholder="Giá mới" CssClass="form-base" data-rule-number="true"></asp:TextBox>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="textfield" class="control-label col-sm-2">Mã sản phẩm: </label>
                            <div class="col-sm-10">
                                <asp:TextBox ID="txtProductCode" runat="server" placeholder="Mã sản phẩm" CssClass="form-control"></asp:TextBox>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="textfield" class="control-label col-sm-2">Tùy chọn: </label>
                            <div class="col-sm-10">
                                <asp:CheckBox ID="chkIsActive" runat="server" Checked="true" />
                                <label for="<%= chkIsActive.ClientID %>">Kích hoạt</label>
                                <asp:CheckBox ID="chkIsExist" runat="server" Checked="true" />
                                <label for="<%= chkIsExist.ClientID %>">Còn hàng</label>
                                <asp:CheckBox ID="chkIsVAT" runat="server" />
                                <label for="<%= chkIsVAT.ClientID %>">Bao gồm VAT</label>
                                <asp:CheckBox ID="chkIsHot" runat="server" />
                                <label for="<%= chkIsHot.ClientID %>">Nổi bật</label>
                                <asp:CheckBox ID="chkIsHome" runat="server" />
                                <label for="<%= chkIsHome.ClientID %>">Mới</label>
                                <asp:CheckBox ID="chkIsSellGood" runat="server" />
                                <label for="<%= chkIsSellGood.ClientID %>">Bán chạy</label>
                                <asp:CheckBox ID="chkIsPromotion" runat="server" />
                                <label for="<%= chkIsPromotion.ClientID %>">Khuyến mại</label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">Thứ tự: </label>
                            <div class="col-sm-10">
                                <uc1:NumberIncrement runat="server" ID="txtOrderSort" />
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="second22">
                        <div class="tab-content tab-content-inline tab-content-bottom">
                            <div class="tab-pane active" id="vn">
                                <uc1:ContentLanguage runat="server" ID="contentLngDefault" />
                            </div>
                            <asp:Repeater ID="listLanguage" runat="server" OnItemDataBound="listLanguage_ItemDataBound">
                                <ItemTemplate>
                                    <div class="tab-pane" id="<%# Eval("LanguageCode") %>">
                                        <uc1:ContentLanguage runat="server" ID="ContentLanguage" />
                                    </div>
                                </ItemTemplate>
                            </asp:Repeater>
                        </div>
                    </div>
                    <div class="tab-pane" id="second33">
                        <uc1:SelectImages runat="server" ID="SelectImages" />
                    </div>
                    <div class="tab-pane" id="second55">
                        <%if (ProductID > 0)
                          { %>
                        <div class="form-group">
                            <label for="textfield" class="control-label col-sm-2">Chọn thuộc tính: </label>
                            <div class="col-sm-10">
                                <label for="<%= ddlAttribute.ClientID %>">Thuộc tính: </label>
                                <asp:DropDownList ID="ddlAttribute" runat="server"></asp:DropDownList>
                                <label for="<%= ddlAttributeValue.ClientID %>">&nbsp;&nbsp;Giá trị: </label>
                                <asp:DropDownList ID="ddlAttributeValue" runat="server"></asp:DropDownList>
                                <input type="button" class="btn btn-primary" id="addRow" value="Thêm mới" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="textfield" class="control-label col-sm-2">Thuộc tính chọn: </label>
                            <div class="col-sm-10">
                                <div class="alert alert-info">
                                    <h4>Thêm giá chị thuộc tính!</h4>
                                    <p>Bạn kích vào nút thêm để bổ xung giá trị mới, giá trị này sẽ được lựa chọn khi bạn thêm sản phẩm.</p>
                                </div>
                                <table id="user" class="table table-bordered table-striped table-force-topborder" style="clear: both">
                                    <thead><tr><th class="tb-stt">STT</th><th>Thuộc tính</th><th>Giá trị</th><th>Xóa</th></tr></thead>
                                    <tbody>
                                        <asp:Repeater ID="rpList" runat="server">
                                            <ItemTemplate>
                                                <tr>
                                                    <td class="tb-stt" ><%# Container.ItemIndex + 1 %></td>
                                                    <td><a><%# Eval("AttributeID") %></a></td>
                                                    <td><i data-value="<%# Eval("AttributeValueID") %>"  data-attrid="<%# Eval("AttributeID") %>" data-name="editattval1" data-type="select" data-pk="<%# Eval("PAID") %>,<%= ProductID %>" data-placement="right" data-original-title="Chọn giá trị" class="editable editable-click"><%# Eval("Value") %></i><td class="tb-stt"><a href="#" data-attrid="<%# Eval("PAID") %>" class="btn delete" rel="tooltip" title="" data-original-title="Edit">
                                                    <i class="fa fa-edit"></i>
                                                </a></td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <%}
                          else
                          { %>
                        <p>Sản phẩm này chưa tồn tại để chọn thuộc tính.</p>
                        <% }%>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () { ProductEdit('#<%=ddlAttribute.ClientID%>', '#<%=ddlAttributeValue.ClientID%>', '<%= ProductID%>') });
</script>
